<?php

//UMA new
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;

class Zip extends Model
{
    public $timestamps = false;
    /**
     * 查询范围
     * クエリスコープ
     * @param  mixed $query
     * @param  mixed $code
     * @return void
     */
    public function scopeSearch($query, $code)
    {
        return $query->where('zip7', $code);
    }
    
    

        
    /**
     * getPrecodeAttribute
     *
     * @return string
     */
    public function getPrecodeAttribute()
    {
        return Str::limit($this->zip_cd, 2, '');
    }
}
